@extends('layouts.console_header')

@section('title', '启动页列表')

@section('resources')
    @parent
    <style>
        .banner_classify{padding: 10px 0 0 10px;margin: 5px 0;background-color: #fff;}
        .banner_classify a{font-size: 16px;margin-right: 60px;padding-bottom: 10px;cursor: pointer;}
        .banner_title select{width: 100px;height: 30px;line-height: 30px;text-align: center;border: 1px solid #000;margin: 9px 15px;}
        .banner_all li{background-color: #fff;}
        #example th{text-align: center;}
        .banner_show{color: #9955c6;border-bottom: 3px solid #9955c6;}
    </style>
@endsection

@section('content')
<section class="user_list">
    <div style="border-bottom: 2px solid #9955c6;overflow: hidden;">
        <p class="fz_14 account_title fl" style="border: none;">
            <span style="color: #7f7f7f;"><a href="/console/index">首页</a>>用户版运营></span>
            <span class="co_violet">启动页管理</span>
        </p>
    </div>
    <ul class="banner_all">
        <li>
            <div class="banner_title" class="oh">
                <p style="margin: 9px 15px;" class="fl"></p>
                <a style="color: #fff;" href="/console/user/banner/appstart/add?cityid={{$cityid}}"><p class="fr tc back_btn">+新增</p></a>
            </div>
            <table id="example" class="display" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>启动页图片</th>
                        <th>启动页名称</th>
                        <th>发布类型</th>
                        <th>跳转类型</th>
                        <th>生效时间</th>
                        <th>发布人</th>
                        <th>发布状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <th>序号</th>
                        <th>启动页图片</th>
                        <th>启动页名称</th>
                        <th>发布类型</th>
                        <th>跳转类型</th>
                        <th>生效时间</th>
                        <th>发布人</th>
                        <th>发布状态</th>
                        <th>操作</th>
                    </tr>
                </tfoot>
                <tbody>
                    @foreach($appstartlists as $list)
                        <tr>
                        @if(!isset($j))
                            <td>{{$j=1}}</td>
                        @else
                            <td>{{++$j}}</td>
                        @endif
                            <td>
                                <img style="width: 108px;height: 162px;" src="{{env('IMAGE_DOMAIN')}}{{$list['picurl']}}" alt="">
                            </td>
                            <td>{{$list['name']}}</td>
                        @if($list['isglobal'] == '1')
                            <td>全国</td>
                        @else
                            <td>当地</td>
                        @endif
                        @if($list['type'] == 'shop')
                            <td>商家详情</td>
                        @elseif($list['type'] == 'h5')
                            <td>H5页面</td>
                        @else
                            <td>空白页</td>
                        @endif
                            <td>{{$list['starttime']}}至{{$list['lasttime']}}</td>
                            <td>{{$list['realname']}}</td>
                        @if($list['status'] == '0')
                            <td>待发布</td>
                        @elseif($list['status'] == '1')
                            <td>已发布</td>
                        @else
                            <td></td>
                        @endif
                            <td>
                            @if(($isglobal==1) || ($list['isglobal'] !=1))
                                <a class="revise co_violet" href="/console/user/banner/appstart/get?appstartid={{$list['appstartid']}}&cityid={{$cityid}}">修改</a>
                                @if($list['status'] == '0')
                                    <a class="forbidden co_red" href="#" onclick="delete_appstart('{{$list['appstartid']}}')">删除</a>
                                @endif
                            @endif
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </li>
    </ul>
            
</section>
@endsection

@section('scriptResources')
    @parent
    <script>
    var cityid = '{{$cityid}}';
    //删除启动页
    function delete_appstart(appstartid) {
        var isconfirm = confirm("确定要删除？");
        if(isconfirm) {
            $.ajax({
                url : "/console/user/banner/appstart/delete",
                type : "post",
                data : {
                    appstartid:appstartid,
                    cityid:cityid
                    },
                dataType: "json",
                success:function (data){
                    if(data.status == 'success') {
                        window.location.href="/console/user/banner/appstart/list?type=app_start&cityid=" + cityid + "&now=" + Date.parse(new Date());
                    } else {
                        alert(data.message);
                    }
                }
            });
        }
    }
    </script>
@endsection